package lua;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBuf;
import lion.netty4.message.RequestMessageRaw;
import lion.netty4.message.SendToMessageRaw;
public final class LuaMessageLogin{
	public static final class C2SLogin{
		public String uname;
		public static final int id = 1001;

		public static C2SLogin parse(RequestMessageRaw request){
			C2SLogin retObj = new C2SLogin();
			try{
			retObj.uname=request.readString();
			}catch(Exception e){e.printStackTrace();}
			return retObj;
		}
	}
	public static final class S2CLogin{
		public int uid;
		public long sessionId;
		public int is_success;
		public String hall_host;
		public int hall_port;
		public S2CLogin(int puid,String phall_host,long psessionId,int pis_success,int phall_port){
			this.uid=puid;
			this.hall_host=phall_host;
			this.sessionId=psessionId;
			this.is_success=pis_success;
			this.hall_port=phall_port;
		}
		public S2CLogin(){}
		public SendToMessageRaw build(ByteBufAllocator alloc){
			try{
			SendToMessageRaw retMsg = new SendToMessageRaw(alloc, 1002);
			retMsg.writeInt(this.uid);
			retMsg.writeLong(this.sessionId);
			retMsg.writeInt(this.is_success);
			retMsg.writeString(this.hall_host);
			retMsg.writeInt(this.hall_port);
			return retMsg;
			}catch(Exception e){e.printStackTrace();return null;}
		}
	}
	public static final class S2ErrorCode{
		public int error_num;
		public S2ErrorCode(int perror_num){
			this.error_num=perror_num;
		}
		public S2ErrorCode(){}
		public SendToMessageRaw build(ByteBufAllocator alloc){
			try{
			SendToMessageRaw retMsg = new SendToMessageRaw(alloc, 998);
			retMsg.writeInt(this.error_num);
			return retMsg;
			}catch(Exception e){e.printStackTrace();return null;}
		}
	}
	public static final class C2SOpenLogin{
		public String code;
		public String access_token;
		public static final int id = 1003;

		public static C2SOpenLogin parse(RequestMessageRaw request){
			C2SOpenLogin retObj = new C2SOpenLogin();
			try{
			retObj.code=request.readString();
			retObj.access_token=request.readString();
			}catch(Exception e){e.printStackTrace();}
			return retObj;
		}
	}
	public static final class S2COpenLogin{
		public String open_id;
		public String access_token;
		public long sessionId;
		public int is_success;
		public String hall_host;
		public int hall_port;
		public S2COpenLogin(String paccess_token,String popen_id,String phall_host,long psessionId,int pis_success,int phall_port){
			this.access_token=paccess_token;
			this.open_id=popen_id;
			this.hall_host=phall_host;
			this.sessionId=psessionId;
			this.is_success=pis_success;
			this.hall_port=phall_port;
		}
		public S2COpenLogin(){}
		public SendToMessageRaw build(ByteBufAllocator alloc){
			try{
			SendToMessageRaw retMsg = new SendToMessageRaw(alloc, 1004);
			retMsg.writeString(this.open_id);
			retMsg.writeString(this.access_token);
			retMsg.writeLong(this.sessionId);
			retMsg.writeInt(this.is_success);
			retMsg.writeString(this.hall_host);
			retMsg.writeInt(this.hall_port);
			return retMsg;
			}catch(Exception e){e.printStackTrace();return null;}
		}
	}
	public static final class C2SGuestLogin{
		public int accountId;
		public static final int id = 1005;

		public static C2SGuestLogin parse(RequestMessageRaw request){
			C2SGuestLogin retObj = new C2SGuestLogin();
			try{
			retObj.accountId=request.readInt();
			}catch(Exception e){e.printStackTrace();}
			return retObj;
		}
	}
	public static final class S2CGuestLogin{
		public int accountId;
		public long sessionId;
		public int is_success;
		public String hall_host;
		public int hall_port;
		public S2CGuestLogin(int paccountId,String phall_host,long psessionId,int pis_success,int phall_port){
			this.accountId=paccountId;
			this.hall_host=phall_host;
			this.sessionId=psessionId;
			this.is_success=pis_success;
			this.hall_port=phall_port;
		}
		public S2CGuestLogin(){}
		public SendToMessageRaw build(ByteBufAllocator alloc){
			try{
			SendToMessageRaw retMsg = new SendToMessageRaw(alloc, 1006);
			retMsg.writeInt(this.accountId);
			retMsg.writeLong(this.sessionId);
			retMsg.writeInt(this.is_success);
			retMsg.writeString(this.hall_host);
			retMsg.writeInt(this.hall_port);
			return retMsg;
			}catch(Exception e){e.printStackTrace();return null;}
		}
	}
}
